package seqlist.oj;

public class Num141 {
    public boolean hasCycle(ListNode head) {
        if(head==null || head.next==null){
            return false;
        }
        ListNode low=head,fast=head;
        while (fast!=null && fast.next!=null){
            low=low.next;
            fast=fast.next.next;
            if(fast==low){
                return true;
            }
        }
        return false;
    }
}
